package com.cjg.single;


import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

//enum 是一个class类
public enum  eumedemo04 {

    i; //随便写什么 都代表 本类的new

    public eumedemo04 getInstance(){
        return i;
    }




}
class T{
    public static void main(String[] args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
        eumedemo04 instance = eumedemo04.i;
        eumedemo04 instance1 = eumedemo04.i;
        System.out.println(instance==instance1);

        Constructor<eumedemo04> declaredConstructor = eumedemo04.class.getDeclaredConstructor(String.class,int.class);

        declaredConstructor.setAccessible(true);
        ///NoSuchMethodException
        eumedemo04 eumedemo04 = declaredConstructor.newInstance();

        System.out.println(instance==eumedemo04);
    }
}
